-- utilities used in the star package system
private import base;

foldLeft has type ((%b, %a) => %b, %b, cons of %a) => %b;
foldLeft(f, a, lis) is valof {
	var r := lis;
	var res := a;
	while r matches cons(x, xs) do {
	  res := f(res, x);
	  r := xs;
	};
	valis res;
};